home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 12 / Cream of the Crop 12 (Part II) / Cream of the Crop 12 (Part II).iso / BBS / EZY120_1.ZIP / STRUCT.ARJ / CLIB.ARJ / STR2.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1996-03-09  |  443 b   |  23 lines

  1.  
  2. #include <ezylib.h>
  3. #include <string.h>
  4.  
  5. char *FirstWord(char *FirstWordStr,char *SourceStr)
  6. {
  7.   char *Temp = new char[strlen(SourceStr)+1];
  8.   strcpy(Temp,SourceStr);
  9.   char *S = strchr(Temp,' ');
  10.   if (S) {
  11.     strcpy(SourceStr,S);
  12.     TrimLead(SourceStr);
  13.     *S = '\0';
  14.     strcpy(FirstWordStr,Temp);
  15.   } else {
  16.     strcpy(FirstWordStr,SourceStr);
  17.     *SourceStr = '\0';
  18.   }
  19.   delete Temp;
  20.   return(FirstWordStr);
  21. }
  22.  
  23.